var Mysql = require("node-mysql-promise");
var setting = require("../database/setting.js");

class CommonModel {
	constructor(){
		this.connection = Mysql.createConnection(setting);
	}
	
	//从数据库获取出库单（按日期排序）
	findAllOrderByDate(conn,sql){
		let pro = new Promise((resolve, reject) => {
			conn.query(sql, function(err, rows, fields) {
				if (err) throw err;
				else {
					resolve(rows);
				}
			});
		});
		return pro;
	}
}

module.exports = CommonModel;